package com.example.interview.service;

import com.example.interview.domain.Order;
import com.example.interview.mapper.OrderMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Service
public class OrderService {
    @Resource
    OrderMapper mapper;

    public void addOrder(long userId, long goodsId, BigDecimal quantity) {
        mapper.addOrder(userId, goodsId, quantity,"0",new Date());
    }

    public Order queryOrderByOrderId(long orderId) {
        return mapper.queryOrderByOrderId(orderId);
    }

    public void updateOrderStatusById(long orderId) {
        mapper.updateOrderStatusById(orderId);
    }

    public List<Order> queryOrderByUserId(long userId) {
        return mapper.queryOrderByUserId();
    }
}
